/**
 * Created by ebi on 2017/5/11.
 */
import fetch from "./fetch";
export default {
  login (params) {
    return fetch('/api/v1/login', params, 'post')
  },
  reg (params) {
    return fetch('/api/v1/register', params, 'post')
  },
  menu: {
    getAll() {
      return fetch("/api/menu/getMenu"); // 默认是get，第三个参数可以不传
    },
    getOne(id) {
      return fetch("/api/menu/getMenuById", { id });
    },
    edit(params = { id: 0, name: "", icon: "", parentId: 0, link: "" }) {
      return fetch("/api/menu/editMenu", params, "post");
    },
    remove(id) {
      return fetch("/api/menu/removeMenuById", { id }, "post");
    }
  },
  user: {
    get () {
      return fetch("/api/v1/user");
    }
  },
  images: {
    add (params) {
      return fetch("/api/v1/image/upload", params, "post");
    },
  },
  store: {
    add (params) {
      return fetch("api/v1/store/add", params, 'post')
    },
    get () {
      return fetch("api/v1/store/get")
    }
  },
  seat: {
    getCategory(params) {
      return fetch("/api/v1/category/get", params);
    },
    addCategory(params) {
      return fetch("/api/v1/category/add", params, "post"); 
    },
    updateCategory(params) {
      return fetch("/api/v1/category/update", params, "post");
    },
    deleteCategory(params) {
      return fetch("/api/v1/category/delete", params, "post");
    },
    get(params) {
      return fetch("/api/v1/seat/get", params);
    },
    add(params) {
      return fetch("/api/v1/seat/add", params, "post"); 
    },
    update(params) {
      return fetch("/api/v1/seat/update", params, "post");
    },
    delete(params) {
      return fetch("/api/v1/seat/delete", params, "post");
    }
  },
  address: {
    addressOption (params) {
      return fetch('/api/v1/address/t/getAddressList', params, 'post')
    }
  }
};
